﻿Imports System.Windows.Forms
Namespace Dialogs
    ''' <summary>Encapsulates the dbiWSFListPrintSettings control and applies the settings to the provided dbiList.</summary>
    Public Class dlgListPrintSettings
        Private l_List As Dbi.WinControl.List.dbiList
        Private l_PrintSettings As System.Drawing.Printing.PrinterSettings

        ''' <summary>Initializes the dbiWSFListPrinterDialog</summary>
        Public Sub New(ByRef curList As Dbi.WinControl.List.dbiList, ByRef curPrinterSettings As System.Drawing.Printing.PrinterSettings)
            InitializeComponent()
            l_List = curList
            l_PrintSettings = curPrinterSettings
            Me.DbiListPrintSettings1.LoadSettingsFromList(curList, curPrinterSettings)

        End Sub

        ''' <summary>Applies the settings to the dbiList and returns the System.Windows.Forms.DialogResult.OK</summary>
        Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
            Me.DbiListPrintSettings1.ApplySettingsToList(l_List, l_PrintSettings)
            Me.DialogResult = System.Windows.Forms.DialogResult.OK
            Me.Close()
        End Sub

        ''' <summary>Does not apply the settings to the dbiList and returns the System.Windows.Forms.DialogResult.Cancel</summary>
        Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
            Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
            Me.Close()
        End Sub

    End Class
End Namespace